﻿@{
    ViewBag.Title = "已预约挂号列表";
    Layout = "~/Views/Shared/_Form.cshtml";
    var from = (ViewBag.from as string) ?? "";
}
<style>
    .table-responsive {
        border: 0;
    }

    .ui-jqgrid .ui-jqgrid-pager .ui-pager-table {
        width: 90%;
    }
</style>

<!--患者信息 包括病历号  姓名 -->
<form id="formPatSer" style="margin:2px;margin-top:10px;">
    <div class="gridPanel">
        <table id="patGridList" rel="formPatSer"></table>
        <div id="gridPager" style="padding-right:20%"></div>
    </div>
</form>
<script>
    //上一个window对象
    var prevWindow;
    if ('@(from)' !== '') {
        prevWindow = top.top.frames['@(from)'];
    }
    else {
        prevWindow = $.currentWindow();
    }

    $(function () {

        var obj = new Object;
        obj.mzlx = $.request("mzlx");
        obj.patid = $.request("patid");
        //收费组合
        obj.isfeegroup = $.request("isfeegroup");
        var searInfo = new PatSearchInfo();
        //加载数据
        searInfo.init(obj);

    });
    var PatSearchInfo = (function () {
        //加载列表
        var loadGrid = function (data) {
            var $gridList = $("#patGridList");
            $gridList.dataGrid({
                height: $(window).height() - 150,
                autowidth: false,
                width: $("#formPatSer").width() - 10,
                url: "@Url.Action("GetIsMzghBook")",
                postData: { mzlx: data.mzlx, patid: data.patid, isfeegroup: data.isfeegroup },
                caption: '已预约挂号科室',
                colModel: [
                    { label: 'ghpbId', name: 'ScheduId', hidden: true, key: true },
                    { label: 'BookId', name: 'BookId', hidden: true },
                    { label: 'zlxm', name: 'zlxm', width: 100, align: 'left',hidden:true },
                    { label: 'ghlx', name: 'ghlx', width: 120, align: 'left', hidden: true },
                    { label: 'QueueNo', name: 'QueueNo', width: 120, align: 'left', hidden: true },
                    { label: 'OutDate', name: 'OutDate', width: 120, align: 'left', hidden: true },
                    { label: 'ysgh', name: 'ysgh', width: 120, align: 'left', hidden: true },
                    { label: 'ysxm', name: 'ysxm', width: 120, align: 'left', hidden: true },
                    { label: 'Regtype', name: 'Regtype', width: 120, align: 'left', hidden: true },
                    { label: 'Title', name: 'Title', width: 120, align: 'left', hidden: true },
                    { label: 'AppId', name: 'AppId', width: 120, align: 'left', hidden: true },
                    { label: 'ks', name: 'ks', hidden: true, width: 120, align: 'left', hidden: true },
                    { label: '挂号科室', name: 'ksmc', width: 120, align: 'left' },
                    { label: '挂号项目', name: 'sfxmmc', width: 120, align: 'left' },
                    { label: '诊疗项目', name: 'zlxmmc', width: 120, align: 'left' },
                    { label: '时间段', name: 'PeriodDesc', width: 100, align: 'left' }
                ],
                pager: "#gridPager",
                sortname: 'OutDate desc',
                viewrecords: false
            });
        };

        var myPatSearchInfo = function (data) {

        }

        //加载事件
        myPatSearchInfo.prototype.init = function (data) {
            loadGrid(data);
        };
        return myPatSearchInfo;
    }());

    //jqGrid 双击选中某行
    function btn_edit() {
        PatSearchConfirm();
    }

    function PatDbGrid() {
        var $gridList = $("#patGridList");
        var seleRowid = jQuery("#patGridList").jqGrid("getGridParam", "selrow");
        if (!(seleRowid)) {
            $.modalAlert("请选中一条信息", 'warning');
            return;
        }
        var obj = new Object();
        obj.ScheduId = $gridList.jqGridRowValue().ScheduId;
        obj.zlxm = $gridList.jqGridRowValue().zlxm;
        obj.ghlx = $gridList.jqGridRowValue().ghlx;
        obj.ks = $gridList.jqGridRowValue().ks;
        obj.ksmc = $gridList.jqGridRowValue().ksmc;
        obj.sfxmmc = $gridList.jqGridRowValue().sfxmmc;
        obj.zlxmmc = $gridList.jqGridRowValue().zlxmmc;
        obj.OutDate = $gridList.jqGridRowValue().OutDate;
        obj.QueueNo = $gridList.jqGridRowValue().QueueNo;
        obj.ysgh = $gridList.jqGridRowValue().ysgh;
        obj.ysxm = $gridList.jqGridRowValue().ysxm;
        obj.Regtype = $gridList.jqGridRowValue().Regtype;
        obj.Title = $gridList.jqGridRowValue().Title;
        obj.ghly = $gridList.jqGridRowValue().AppId;
        obj.BookId = $gridList.jqGridRowValue().BookId;
        prevWindow.GetQueryghyy(obj,null);
        //关闭窗口
        ReceiptCancle();
    }
    //确定 主页面调用
    function PatSearchConfirm() {
        PatDbGrid();
    }

    //取消
    function ReceiptCancle() {
        $.modalClose();
    }
</script>
